#!/bin/bash

export PATH="$PATH:`pwd`/node_modules/.bin"

set -e
echo "[1/3]: Building Code"
npm run prepack:all

echo "[2/3]: Linting Code"
npm run lint

echo "[3/3]: Testing Project"
for I in packages/*/; do
  if [[ "$PGVERSION" != "9.4" || ( "$I" != "packages/lds/" && "$I" != "packages/subscriptions-lds/" ) ]]; then
    cd $I
    npm run test
    cd -
  fi;
done

echo ""
echo "CI completed succesfully 🎉"
echo ""
